<?php

namespace common\models\articlesite;

use Yii;

/**
 * This is the model class for table "articlesite_category".
 *
 * @property string $id
 * @property integer $parentid
 * @property string $name
 * @property integer $status
 */
class ArticlesiteCategory extends \yii\db\ActiveRecord
{

    //主要用于日志记录
    public $uselog = [
        'tabcomment' => '文章分类',      //用于修改了什么的显示
        'mainfield' => 'name',      //主要的显示标题的字段
        'picturefield' => [],        //图片字段
        'timefield' => [],       //时间字段
        'unsetfiled' =>[],      //不需要记录的字段
    ];




    const CATEGORY_SHOW = 1;
    const CATEGORY_HIDDEN = 0;

    public static $statuses = [
        self::CATEGORY_SHOW => '显示',
        self::CATEGORY_HIDDEN => '不显示',
    ];




    //文章用途
    const USEFOR_SCREEN = 1;
    const USEFOR_PERSON = 2;
    const USEFOR_JIANJIE = 3;
    const USEFOR_XIEYI = 4;
    public static $usefor = [
        self::USEFOR_SCREEN => '大屏幕',
        self::USEFOR_PERSON => '业务员提醒',
        self::USEFOR_JIANJIE => '普通文章',
        self::USEFOR_XIEYI => '认养协议',
    ];


    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'articlesite_category';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['name', 'status'], 'required'],
            [['parentid', 'status','usefor'], 'integer'],
            [['name'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'parentid' => '父类',
            'name' => '分类名称',
            'status' => '状态',
            'usefor' => '用于',
        ];
    }


}
